<?php

namespace app\admin\model;

use think\Model;


class UserCardLog extends Model
{

    

    

    // 表名
    protected $name = 'user_card_log';
    
    // 自动写入时间戳字段
    protected $autoWriteTimestamp = 'integer';

    // 定义时间戳字段名
    protected $createTime = 'createtime';
    protected $updateTime = 'updatetime';
    protected $deleteTime = false;

    // 追加属性
    protected $append = [
        'wallet_type_text',
        'oper_type_text'
    ];
    

    
    public function getWalletTypeList()
    {
        return ['money' => __('Money'), 'score' => __('Score')];
    }

    public function getOperTypeList()
    {
        return ['user' => __('User'), 'store' => __('Store'), 'admin' => __('Admin'), 'system' => __('System')];
    }


    public function getWalletTypeTextAttr($value, $data)
    {
        $value = $value ? $value : (isset($data['wallet_type']) ? $data['wallet_type'] : '');
        $list = $this->getWalletTypeList();
        return isset($list[$value]) ? $list[$value] : '';
    }


    public function getOperTypeTextAttr($value, $data)
    {
        $value = $value ? $value : (isset($data['oper_type']) ? $data['oper_type'] : '');
        $list = $this->getOperTypeList();
        return isset($list[$value]) ? $list[$value] : '';
    }




}
